package com.sunwayworld.basemodule.basedata.exporttemplate.resource.impl;

import com.sunwayworld.basemodule.basedata.exporttemplate.bean.LimsExportTemplateBean;
import com.sunwayworld.basemodule.basedata.exporttemplate.resource.LimsExportTemplateResource;
import com.sunwayworld.basemodule.basedata.exporttemplate.service.LimsExportTemplateService;
import com.sunwayworld.module.item.file.bean.CoreFileBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.sunwayworld.framework.spring.annotation.GikamBean;
import com.sunwayworld.framework.log.annotation.Log;
import com.sunwayworld.framework.log.annotation.LogModule;
import com.sunwayworld.framework.log.annotation.LogType;
import com.sunwayworld.framework.restful.data.RestJsonWrapperBean;

import java.util.List;

@LogModule("导入导出模板")
@RestController
@GikamBean
public class LimsExportTemplateResourceImpl implements LimsExportTemplateResource {

    @Autowired
    private LimsExportTemplateService limsExportTemplateService;

    @Override
    public LimsExportTemplateService getService() {
        return limsExportTemplateService;
    }

    @Log(value = "新增导入导出模板", type = LogType.INSERT)
    @Override
    @RequestMapping(method = RequestMethod.POST)
    public Long insert(RestJsonWrapperBean wrapper) {
        return getService().insert(wrapper);
    }

    @Override
    public List<LimsExportTemplateBean> selectTaskTemplateExport(String templateCode) {
        return getService().selectTaskTemplateExport(templateCode);
    }

    @Override
    public CoreFileBean downloadTemplate(String templateId, Long fileId) {
        return getService().downloadTemplate(templateId, fileId);
    }
}
